<?php
namespace Home\Model;
use Think\Model;
class ComboModel extends Model {
    public function getComboList($cond=null){
    	$res = M('combo')->join('LEFT JOIN command on combo.command_id = command.command_id')
    					->join('resouse on combo.resouse_id = resouse.id')
    			->where($cond)
    		->select();
    	return $res;
    }
    
    public function insertComboInfo($data){
    	if(!$data){
    		return false;
    	}
    	$res = M('combo')->add($data);
    	return $res;
    }
    
    public function insertComboList($data){
    	if(!$data){
    		return false;
    	}
    	$res = M('combo')->addAll($data);
    	return $res;
    }
    
    public function getComboInfo($cond){
    	if(!$cond){
    		return false;
    	}
    	$res = M('combo')->join('LEFT JOIN command on combo.command_id = command.command_id')
    					->join('resouse on combo.resouse_id = resouse.id')
    					->where($cond)
    		->find();
    	return $res;
    }
    
    public function reviseComboInfo($cond,$data){
    	if(!$cond || !$data){
    		return false;
    	}
    	$res = M('combo')->where($cond)
    		->save($data);
    	return $res;
    
    	
    }
}